package com.taocyb.core.uc.manager;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.taocyb.commons.uc.entity.Buyer;
import com.taocyb.commons.uc.vo.BuyerVo;
import com.taocyb.core.uc.dao.BuyerDao;
import com.taocyb.framework.orm.Page;

@Component
@Transactional(readOnly = true)
public class BuyerManager{

	@Autowired
	private BuyerDao buyerDao;
	
	public Page<Buyer> findBuyerList(BuyerVo vo, Page<Buyer> page) {
		int totalCount = buyerDao.findCount(vo);
		page.setTotalCount(totalCount);
		
		List<Buyer> dataList = buyerDao.findList(vo, page);
		page.setDataList(dataList);
		
		return page;
	}
	
	public Long saveBuyer(Buyer buyer){
		return buyerDao.save(buyer);
	}
}